<?php

namespace app\common\model;

use app\common\model\Common;
use think\model\concern\SoftDelete;

class FileLog extends Common
{
    use SoftDelete;
    protected $deleteTime = 'del_time';
    protected $table = 'file_log';
    
    public static function getPath($id){
        $one = self::where(['id'=>$id])->field('file_path,upload_type')->find();
        if($one['upload_type'] == 1){
            $url = 'https://'.config('sysconfig')['api_domain'].$one['file_path'];
        }else{
            $url = 'https://'.$one['file_path'];
        }
        
        return $url;
    }
    public static function getPathAll($id){
        $where = [];
        $where[] = ['id','in',$id];
        $list = self::where($where)->field('file_path,upload_type')->select();
        $urlArr = [];
        foreach($list as $v){
            if($v['upload_type'] == 1){
                $url = 'https://'.config('sysconfig')['api_domain'].$v['file_path'];
            }else{
                $url = 'https://'.$v['file_path'];
            }
            $urlArr[] = $url;
        }
       
        
        return $urlArr;
    }
}
